<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>axios手写</title>
</head>
<body>
	<button>发送</button>
	<button>取消</button>
</body>
<script src="./node_modules/axios/dist/axios.js"></script>
<script type="module">
	import axios from "./index.js";
	// axios.interceptors.request.handlers=[
	// {fulfilled:请求拦截成功1，rejected:请求拦截失败1},
	// {fulfilled:请求拦截成功2，rejected:请求拦截失败2},
	// ]
	
	// axios.interceptors.response.handlers = [
	// {fulfilled:响应拦截成功1，rejected:响应拦截失败1}
	// {fulfilled:响应拦截成功2，rejected:响应拦截失败2}
	// ]
	// r1--->0
	const r1 = axios.interceptors.request.use(function(config){
		console.log("请求拦截成功1")
		return config;
	},function(err){
		console.log("请求拦截失败1",err);
		return err;
	})
	// r2--->1
	const r2 = axios.interceptors.request.use(function(config){
		console.log("请求拦截成功2")
		return config;
	},function(err){
		console.log("请求拦截失败2",err);
		return err;
	})
	console.log(r1,r2)
	const s1 = axios.interceptors.response.use(function(res){
		console.log("响应拦截成功1");
		return res;
		// return res;
	},function(err){
		console.log("响应拦截失败1");
		return err;
	})
	const s2 = axios.interceptors.response.use(function(res){
		console.log("响应拦截成功2");
		return res;
		// return res;
	},function(err){
		console.log("响应拦截失败2");
		return err;
	});
	console.log(s1,s2);// 0 1
	
	axios.get("./index.js").then(value=>{
		console.log(value);
	})
</script>
</html>